package com.sxt.sys.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sxt.sys.domain.LogInfo;
import com.sxt.sys.mapper.LogInfoMapper;
import com.sxt.sys.service.LogInfoService;
import com.sxt.sys.vo.LogInfoVo;
@Service
@Transactional
public class LogInfoServiceImpl implements LogInfoService {
    @Autowired
	private LogInfoMapper logInfoMapper;
	@Override
	public Map<String, Object> queryAllLogInfo(LogInfoVo logInfoVo) {
        //分页插件
		Page<Object> page = PageHelper.startPage(logInfoVo.getPage(), logInfoVo.getRows());
		//查询
		List<LogInfo> list = this.logInfoMapper.queryAllLogInfo(logInfoVo);
		Map<String,Object> map=new HashMap<String,Object>();
		//组装json数据
		map.put("total",page.getTotal());
		map.put("rows", list);
		
		return map;
	}
	// 使用分页插件  法二
	/*		Page<Object> page = PageHelper.startPage(logInfoVo.getPage(),
					logInfoVo.getRows());
			// 查询
			List<LogInfo> list = this.logInfoMapper.queryAllLogInfo(logInfoVo);
			return new DataGridView(page.getTotal(), list);
		}*/
	@Override
	public int deleteByPrimaryKey(Integer id) {
		this.logInfoMapper.deleteByPrimaryKey(id);
		return 0;
	}
	@Override
	public void addLogInfo(LogInfoVo logInfoVo) {
		// TODO Auto-generated method stub
		this.logInfoMapper.insertSelective(logInfoVo);
	}
	
}
